package project.common;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;

public class DateFormatUtiles {
    public static LocalDateTime dateFormat(String date) {
        if (Objects.isNull(date)) {
            return null;
        }
        String replace = date.replace(" ", "T");
        return LocalDateTime.parse(replace);
    }

    public static String dateParse(LocalDateTime time) {
        if (Objects.isNull(time)) {
            return null;
        }
        String s = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(time);
        return s;
    }
}
